package com.whl.basic.util;

/**
 *  AjaxResult
 *  封装异步操作增删改之后的返回结果
 */
public class AjaxResult {
    private Boolean success = true;
    private String message = "操作成功";
    private Object resultObj;

    public AjaxResult(){}

    public AjaxResult(Boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public Object getResultObj() {
        return resultObj;
    }

    // 链式语法改造
    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }

    // 链式语法改造
    public static AjaxResult me(){
        return new AjaxResult();
    }

    public Boolean getSuccess() {
        return success;
    }

    // 链式语法改造
    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public String getMessage() {
        return message;
    }

    // 链式语法改造
    public AjaxResult setMessage(String message) {
        this.message = message;
        return this;
    }

    @Override
    public String toString() {
        return "AjaxResult{" +
                "success=" + success +
                ", message='" + message + '\'' +
                '}';
    }
}
